package errmsg

const (
	SUCCESS = 200
	ERROR   = 500

	// code = 1000 用户模块的错误
	ErrorUsernameUsed   = 1001
	ErrorPasswordWrong  = 1002
	ErrorUserNotExist   = 1003
	ErrorTokenExist     = 1004
	ErrorTokenRuntime   = 1005
	ErrorTokenWrong     = 1006
	ErrorTokenTypeWrong = 1007
	// code = 2000 文章模块的错误
	ErrorCateNameUsed = 2001
	// code = 3000 分类的错误
	ErrorCateNotExist = 3001
	ErrorArtNotExist  = 3002
)

var codeMsg = map[int]string{
	SUCCESS:             "ok",
	ERROR:               "FAIL",
	ErrorUsernameUsed:   "用户已存在",
	ErrorPasswordWrong:  "密码错误",
	ErrorUserNotExist:   "用户不存在",
	ErrorTokenExist:     "TOKEN已存在",
	ErrorTokenRuntime:   "TOKEN已过期",
	ErrorTokenWrong:     "TOKEN不正确",
	ErrorTokenTypeWrong: "TOKEN格式错误",
	ErrorCateNameUsed:   "该分类已存在",
	ErrorCateNotExist:   "该分类不存在",
	ErrorArtNotExist:    "该文章不存在",
}

func GetErrmsg(code int) string {
	return codeMsg[code]
}
